<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<FiltronASP.Areas.Admin.ViewModels.PageGroups.PageGroupsIndexViewModel>" %>
<%@ Import Namespace="FiltronASP.Helpers.HtmlTags" %>
<%@ Import Namespace="FiltronASP.Helpers.Routes" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Zarządzanie grupami stron
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="right-page-buttons2">
        <% Html.RenderPartial("TopIndexButtons"); %>
    </div>  
    <table class="right-pages">
	    <tbody>
	        <% if (Model.CurrentLanguage == null) { %>
                <tr class="right-row">
                    <td class="right-cell-big">Nie wybrano języka.</td>
                </tr>            
            <% }
            else if ((Model.PaginatedPageTypes == null) || (Model.PaginatedPageTypes.Count == 0))
            { //if null   %>
                <tr class="right-row">
                    <td class="right-cell-big">Brak elementów do wyświetlenia.</td>
                </tr>
            <% } else { //if page type null   %>
                <% foreach (var pageType in Model.PaginatedPageTypes)
                   { %>
                    <% if ((Model.PaginatedPageTypes.IndexOf(pageType) % 2) == 0)
                       { %>
                        <tr class="right-row">
                            <td class="right-cell-big">
                                <%= Html.Image("admin-right-cat.png")%>
                                <%= pageType.page_type_name%>
					        </td>
					        <td class="right-cell-mid">
					                <%= Html.ActionLinkWithImage("admin-right-remove.png",
                                                                                " Usuń", "DeletePageGroup", new
                                                                                {
                                                                                    pageTypeToDeleteId = (pageType.page_type_id), 
                                            currentLanguageId = (Model.CurrentLanguage.language_id), 
                                            paginationPage = (Model.PaginatedPageTypes.PageIndex)} )%>    
					        </td>
					        <td class="right-cell-mid">
					            <% if (pageType.page_type_editable)
                    { %>
					                <%= Html.ActionLinkWithImage("admin-right-edit.png",
                                                                                " Edytuj", "EditPageGroup", new
                                                                                {
                                                                                    pageTypeToEditId = (pageType.page_type_id),  
                                            currentLanguageId = (Model.CurrentLanguage.language_id), 
                                            paginationPage = (Model.PaginatedPageTypes.PageIndex)} )%>    
					            <% } //if removable %>
                            </td>

                        </tr>					       
                    <% } else { //if odd row %>                       
                                               <tr class="right-row altrow">
                            <td class="right-cell-big">
                                <%= Html.Image("admin-right-cat.png")%>
                                <%= pageType.page_type_name%>
					        </td>
					        <td class="right-cell-mid">
					                <%= Html.ActionLinkWithImage("admin-right-remove.png",
                                                                                " Usuń", "DeletePageGroup", new
                                                                                {
                                                                                    pageTypeToDeleteId = (pageType.page_type_id), 
                                            currentLanguageId = (Model.CurrentLanguage.language_id), 
                                            paginationPage = (Model.PaginatedPageTypes.PageIndex)} )%>    
					        </td>
					        <td class="right-cell-mid">
					            <% if (pageType.page_type_editable)
                    { %>
					                <%= Html.ActionLinkWithImage("admin-right-edit.png",
                                                                                " Edytuj", "EditPageGroup", new
                                                                                {
                                                                                    pageTypeToEditId = (pageType.page_type_id),  
                                            currentLanguageId = (Model.CurrentLanguage.language_id), 
                                            paginationPage = (Model.PaginatedPageTypes.PageIndex)} )%>    
					            <% } //if removable %>
                            </td>

                        </tr>		       
                    <% } //else odd row %>                       
                <% }    //foreach %>
            <% }    //else null %>
	    </tbody>
    </table>
    <div class="right-pagination">
        <% if ((Model.PaginatedPageTypes != null) && (Model.PaginatedPageTypes.Count > 0))
           { %>
            <% if (Model.PaginatedPageTypes.HasPreviousPage)
               { %>            
                <a href="<%= Url.GeneratePageGroupsListRoute(1, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-first.png")%>" alt="pierwsza" />
                </a>
                <a href="<%= Url.GeneratePageGroupsListRoute(Model.PaginatedPageTypes.PageIndex - 1, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-prev.png")%>" alt="poprzednia" />
                </a>
            <% } //if prev %>
            <% if ((Model.PaginatedPageTypes.HasPreviousPage) || (Model.PaginatedPageTypes.HasNextPage))
               { %>
                &nbsp;&nbsp;
                Strona <%= Model.PaginatedPageTypes.PageIndex%> z <%= Model.PaginatedPageTypes.PagesCount%>
                &nbsp;&nbsp;
            <% } //if %>
            <% if (Model.PaginatedPageTypes.HasNextPage)
               { %>
                <a href="<%= Url.GeneratePageGroupsListRoute(Model.PaginatedPageTypes.PageIndex + 1, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-next.png")%>" alt="następna" />
                </a>
                <a href="<%= Url.GeneratePageGroupsListRoute(Model.PaginatedPageTypes.PagesCount, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-last.png")%>" alt="ostatnia" />
                </a>
            <% } //if next %>    
        <% } //if not null and not empty %>    
    </div>    	                   
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
        Zarządzanie grupami stronami
</asp:Content>
